﻿@model AccountLoginModel
@{
    Layout = null;
    ViewData["Title"] = "Login";
}

<html>
<head>
    <meta charset="utf-8">
    <title>Todo369后台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="~/res/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="~/res/css/admin.css" media="all">
    <link rel="stylesheet" href="~/res/css/login.css" media="all">
</head>
<body layadmin-themealias="default" class="layui-layout-body">
    <div class="layadmin-tabspage-none">

        <div class="layadmin-user-login layadmin-user-display-show" style="display: none;">

            <div class="layadmin-user-login-main">
                <div class="layadmin-user-login-box layadmin-user-login-header">
                    <h2>Todo369</h2>
                    <p>后台管理系统</p>
                </div>
                <form id="form1" method="post">
                    <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                        <div class="layui-form-item">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-username"></label>
                            <input type="text" asp-for="PhoneNum" autocomplete="off" lay-verify="required" placeholder="手机号" class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-password"></label>
                            <input type="password" asp-for="PassWord" lay-verify="required" placeholder="密码" class="layui-input">
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-row">
                                <div class="layui-col-xs7">
                                    <label class="layadmin-user-login-icon layui-icon layui-icon-vercode"></label>
                                    <input type="text" asp-for="VerifyCode" lay-verify="required" placeholder="图形验证码" class="layui-input" autocomplete="off">
                                </div>
                                <div class="layui-col-xs5">
                                    <div style="margin-left: 10px;">
                                        @*<img src="https://www.oschina.net/action/user/captcha?t=1591516581421" class="layadmin-user-login-codeimg" id="LAY-user-get-vercode">*@
                                        <img id="validateCode" title="看不清？换一张" src="@Url.Action("ValidateCode")" style="cursor:pointer;" onclick="this.src=this.src+'?'" />
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <input id="submit" type="button" class="layui-btn layui-btn-fluid" lay-submit lay-filter="*" value="登 入" />
                        </div>
                        <div class="layui-trans layui-form-item layadmin-user-login-other">
                            <label>社交账号登入</label>
                            <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
                            <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
                            <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
                            <a lay-href="/user/reg" class="layadmin-user-jump-change layadmin-link">注册帐号</a>
                        </div>
                    </div>
                </form>
            </div>

            <div class="layui-trans layadmin-user-login-footer">
                <p>© 2020 <a href="http://todo369.top/" target="_blank">todo369.top</a></p>
            </div>
        </div>

    </div>
    <script src="~/res/layui/layui.js"></script>
    <script>

        layui.use(['jquery','layer'], function () {
            var layer = layui.layer
                , jquery = layui.jquery;
            var $ = layui.$;


            $("#submit").click(function () {
                var formData = $("#form1").serializeArray();
                $.ajax({
                    url: "@Url.Content("~/Account/Login")",
                    type: "post",
                    data: formData,
                    dataType: "json",
                    success: function (res) {
                        if (res.code == 0) {
                            location.href = res.data;
                        }
                        else {
                            layer.msg(res.msg);
                            $("#validateCode").click();
                        }
                    },
                    error: function () {
                        layer.msg("请求出错");
                        $("#validateCode").click();
                    }
                });
            });

        });

    </script>

</body>
</html>
